package cn.sdormitory.basedata.dao;

import cn.sdormitory.basedata.dto.StudentDept;
import cn.sdormitory.basedata.dto.StudentExportDTO;
import cn.sdormitory.basedata.entity.BStudent;
import cn.sdormitory.basedata.vo.*;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @创建人：zhouyang
 * @创建时间：2020/11/10 16:21
 * @version：V1.0
 */
@Mapper
@Component
public interface BStudentDao extends BaseMapper<BStudent> {
    //APP端学员登录接口
    BStudent doLoginStudent(@Param("phone")String phone);
    //APP端家长登录接口
    List<BStudent> doLoginParent(@Param("parentPhone")String parentPhone);

    String getStuPassword(@Param("id")int id);

    String getParPassword(@Param("id")int id);

    int updateStuPassword(@Param("id") int id ,@Param("newPassword") String newPassword);

    int updateParPassword(@Param("id") int id ,@Param("newPassword") String newPassword);

    List<BStudent> getBStudentByDormitoryId(@Param("dormitoryId")Long dormitoryId);

    List<BStudentAppVo> getAppBStudentByDormitoryId(@Param("dormitoryId")Long dormitoryId,@Param("accessDate")String accessDate);

    int getAppBStudentCount(@Param("dormitoryId")Long dormitoryId,@Param("accessDate")String accessDate);

    List<BStudentAppVo> getAppBStudentByDormitoryIdNo(@Param("dormitoryId")Long dormitoryId,@Param("accessDate")String accessDate);

    int getAppBStudentCountById(@Param("studentNo")String studentNo,@Param("accessDate")String accessDate);

    List<BStudentAppInfoVo> getAppStuInfoById(@Param("studentNo")String studentNo, @Param("accessDate")String accessDate);

    List<BStudentAppInfoVo> getAppStuInfoByIdNo(@Param("studentNo")String studentNo, @Param("accessDate")String accessDate);

    int getAppBStuHyCount(@Param("dormitoryId")Long dormitoryId,@Param("checkDate")String checkDate);

    List<BStudentAppHyVo> getAppBStuHyByDormitoryId(@Param("dormitoryId")Long dormitoryId, @Param("checkDate")String checkDate);

    List<BStudentAppHyVo> getAppBStuHyByDormitoryIdNo(@Param("dormitoryId")Long dormitoryId);

    int getAppBStuHyCountById(@Param("studentNo")String studentNo,@Param("checkDate")String checkDate);

    List<BStudentAppHyInfoVo> getAppStuHyInfoById(@Param("studentNo")String studentNo, @Param("checkDate")String checkDate);

    List<BStudentAppHyInfoVo> getAppStuHyInfoByIdNo(@Param("studentNo")String studentNo);

    List<BStudentInfoVo> getStuInfoByClassId(@Param("classId")Long classId);

    List<BStudent> getAllStudent();

    /**
     * 根据宿舍号查询当前宿舍所有学生
     * @param dormitoryId
     * @return
     */
    List<BStudent> getStudentByDormitoryId(Long dormitoryId);

    /**
     * 根据id查询学生信息
     * @param id
     * @return
     */
    BStudent getStudentById(int id);
    
    /**
     * 根据id查询学生信息
     * @param studentNos
     * @return
     */
    List<BStudent> getStudentInfoByStudentNos(@Param("studentNos")List<String> studentNos);

    /**
     * 获取学生所在部门
     * @param studentNo
     * @return
     */
    StudentDept getStudentDept(String studentNo);

    List<StudentExportDTO> getStuListOrderByDor();

    /**
     * 获取宿舍楼栋楼层的学生人数(在读的寄宿生)
     * @param buildingNo
     * @param storey
     * @return
     */
    int getDormitoryBuildingStoreyStuNum(String buildingNo, String storey);
//    int updateBatch(List<BStudent> students);
    List<BStudentLeaveCountVo> getStudentLeaveCountByClassId(@Param("id") int id,@Param("startdate") String startdate,@Param("enddate") String enddate,@Param("index") int index,@Param("size") int size);
    String getStudentLeaveTotalCount(@Param("id") int id,@Param("startdate") String startdate,@Param("enddate") String enddate);
	
    /**
     * 获取住宿学生列表
     * @author alex
     * @param: classId
     * @date 2024/10/18 10:43
     * @return
     */
	List<BStudentListVo> getDormitoryStudentListByClassId(@Param("classId") String classId);
    
    BStudent getStudentByStudentNo(String studentNo);
    
    
}
